package controllers

import (
	"Trace/constant"
	"Trace/utils"

	beego "github.com/beego/beego/v2/server/web"
)

type UserController struct {
	beego.Controller
}

// TODO /doLogin 登录接口 增加本地 + 区块链认证 + jwt认证
func (Trace *UserController) GetUserAddress() {
	userName := Trace.GetString("userName")
	user := map[string]interface{}{}
	if userName == "producer" {
		user["address"] = constant.ProducerAddress
	} else if userName == "distributor" {
		user["address"] = constant.DistributorAdress
	} else if userName == "reatiler" {
		user["address"] = constant.ReatilerAdress
	} else {
		user["error"] = "error,user not found"
	}
	Trace.Data["json"] = utils.Resp(200, "success", user)
	Trace.ServeJSON()

}

//TODO /roleJudge 角色判定接口
